package st.learnopengl.apps.assets

import st.learnopengl.common.Resource
import org.lwjgl.assimp.Assimp


class ModelLoader {

    fun load(path: String): Model {
        println("VersionMajor = ${Assimp.aiGetVersionMajor()}")
        println("VersionMinor = ${Assimp.aiGetVersionMinor()}")

        val scene = Assimp.aiImportFile(Resource.getResourcePath(Resource.ModelRoot + path)
            , Assimp.aiProcess_Triangulate
                    or Assimp.aiProcess_GenSmoothNormals
                    or Assimp.aiProcess_FlipUVs
                    or Assimp.aiProcess_JoinIdenticalVertices
        )

        println("scene.flags =  ${scene!!.mFlags()}")
        println("scene animations ${scene!!.mNumAnimations()}")
        println("scene textures ${scene!!.mNumTextures()}")
        println("scene mesh ${scene.mNumMeshes()}")
        println("scene materials ${scene.mNumMaterials()}")

        val m = Model(scene)


        return m
    }

    companion object {
        @JvmStatic
        fun main(args: Array<String>) {
            st.learnopengl.apps.assets.ModelLoader().load("untitled2.dae")
        }
    }
}